Skip to content

feat: agent-day task — autonomous Sunday feature implementation#108

Open
sweetmantech wants to merge 4 commits intomainfrom
feature/agent-day-task
Open

feat: agent-day task — autonomous Sunday feature implementation#108
sweetmantech wants to merge 4 commits intomainfrom
feature/agent-day-task

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented Mar 23, 2026

Summary

  • Adds agent-day scheduled task (Trigger.dev) that runs every Sunday at 10 AM ET
  • Fully autonomous end-to-end: plans feature → codes it → reviews PRs → merges → announces
  • Makes callbackThreadId optional in coding-agent and update-pr schemas (backward compatible)

How it works

  1. Gather context — fetches 5 recent commits from all 11 submodule repos via GitHub API
  2. Plan — calls Claude to propose the next most valuable feature based on recent work
  3. Implement — triggers the existing coding-agent task with the AI-generated prompt
  4. Review — for each PR: waits for CI checks, assesses review comments with Claude, applies valid feedback via update-pr (max 3 iterations), tests Vercel preview health endpoint
  5. Merge — squash-merges approved PRs via GitHub API
  6. Announce — posts summary to Slack #C08HN8RKJHZ

New files

  • src/tasks/agentDayTask.ts — main Sunday cron task
  • src/github/fetchRecentSubmoduleCommits.ts
  • src/github/waitForPRChecks.ts
  • src/github/fetchPRReviews.ts
  • src/github/mergePR.ts
  • src/github/getVercelPreviewUrl.ts
  • src/slack/postToSlackChannel.ts
  • src/ai/generateFeaturePrompt.ts
  • src/ai/assessPRFeedback.ts

Tests

  • 186/186 tests passing
  • All new utilities have unit tests with mocked fetch

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a scheduled weekly task to generate and implement feature prompts, open PRs, run CI checks, iterate on reviews, attempt merges, and post Slack summaries.
    • Added AI helpers to generate feature prompts, assess PR feedback, and provide a fallback prompt.
    • Added GitHub utilities to fetch recent submodule commits, PR reviews/comments, check PR checks, find Vercel preview URLs, and merge PRs.
    • Added Slack posting helper.
  • Refactor

    • Made callback thread ID optional across task workflows.
  • Tests

    • Added comprehensive test suites covering GitHub helpers, AI helpers, Slack posting, and PR workflow behaviors.

Adds a new `agent-day` scheduled task that runs every Sunday at 10 AM ET
and implements a new feature end-to-end without human intervention:

1. Fetches recent commits from all 11 submodule repos via GitHub API
2. Uses Claude (Anthropic API) to plan the next most valuable feature
3. Triggers `coding-agent` to implement it and open PRs
4. Reviews each PR: waits for CI checks, assesses review comments with Claude
5. Applies valid feedback via `update-pr` task (up to 3 iterations per PR)
6. Tests Vercel preview deployments (health check for api/chat repos)
7. Merges approved PRs via GitHub API (squash merge)
8. Posts a summary to Slack channel #C08HN8RKJHZ

New utilities:
- src/github/fetchRecentSubmoduleCommits.ts
- src/github/waitForPRChecks.ts
- src/github/fetchPRReviews.ts
- src/github/mergePR.ts
- src/github/getVercelPreviewUrl.ts
- src/slack/postToSlackChannel.ts
- src/ai/generateFeaturePrompt.ts
- src/ai/assessPRFeedback.ts

Schema changes (backward compatible):
- codingAgentSchema: callbackThreadId is now optional
- updatePRSchema: callbackThreadId is now optional

Both coding-agent and update-pr tasks skip the Slack callback when
callbackThreadId is not provided (used when triggered programmatically).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00ad07a9-9ed2-4637-a6a3-46c7021d7c6b

📥 Commits

Reviewing files that changed from the base of the PR and between 321e516 and da90290.

📒 Files selected for processing (3)
  • src/tasks/agentDayTask.ts
  • src/telegram/__tests__/sendTelegramMessage.test.ts
  • src/telegram/sendTelegramMessage.ts
📝 Walkthrough

Walkthrough

Adds AI-assisted modules, GitHub integrations, Slack messaging, schemas tweaks, tests, and a scheduled agentDayTask to implement features, iterate on PRs using AI sandbox assessments, run CI/preview checks, and attempt merges; several tasks now conditionally notify a coding-agent callback only when a callbackThreadId is present.

Changes

Cohort / File(s) Summary
AI modules & tests
src/ai/assessPRFeedback.ts, src/ai/generateFeaturePrompt.ts, src/ai/getFallbackPrompt.ts, src/ai/__tests__/assessPRFeedback.test.ts, src/ai/__tests__/generateFeaturePrompt.test.ts
New AI utilities: feedback assessment, feature-prompt generation, fallback prompt; robust error handling around runClaudeCodeAgent and tests mocking agent/logger/metadata.
GitHub integrations & tests
src/github/fetchPRReviews.ts, src/github/fetchRecentSubmoduleCommits.ts, src/github/getVercelPreviewUrl.ts, src/github/mergePR.ts, src/github/waitForPRChecks.ts, src/github/__tests__/fetchPRReviews.test.ts, src/github/__tests__/fetchRecentSubmoduleCommits.test.ts, src/github/__tests__/mergePR.test.ts
New helpers to fetch PR reviews/comments and recent submodule commits, locate Vercel preview URLs, poll/check PR CI runs, and perform squash merges; includes input filtering, auth header usage, error logging, and tests for success and failure branches.
Tasks & orchestration
src/tasks/agentDayTask.ts, src/tasks/codingAgentTask.ts, src/tasks/updatePRTask.ts
New scheduled agentDayTask (Sunday 10 AM ET) orchestrates sandbox creation, prompt generation, coding agent runs, iterative review+apply cycles, preview health checks, and merges; codingAgentTask and updatePRTask now only send callbacks when callbackThreadId is provided.
Slack module & tests
src/slack/postToSlackChannel.ts, src/slack/__tests__/postToSlackChannel.test.ts
New Slack poster that uses chat.postMessage, returns boolean success, logs missing-token or API failures; tests cover token absence and API responses.
Schemas
src/schemas/codingAgentSchema.ts, src/schemas/updatePRSchema.ts
Made callbackThreadId optional in both schemas (was required non-empty string), updating inferred payload types accordingly.
Lightweight test additions
src/github/__tests__/*, src/slack/__tests__/*, src/ai/__tests__/*
Multiple new Vitest suites added across AI/GitHub/Slack modules; tests mock fetch, agent run, and logger behaviors to validate branching and error handling.

Sequence Diagram

sequenceDiagram
    participant Scheduler as Scheduler (Trigger.dev)
    participant AgentTask as agentDayTask
    participant Sandbox as AI Sandbox
    participant GitHub as GitHub API
    participant Slack as Slack API

    Scheduler->>AgentTask: scheduled run (Sun 10am ET)
    AgentTask->>Sandbox: getOrCreateSandbox()
    AgentTask->>GitHub: fetchRecentSubmoduleCommits()
    GitHub-->>AgentTask: commits
    AgentTask->>Sandbox: generateFeaturePrompt(commits)
    Sandbox-->>AgentTask: feature prompt
    AgentTask->>Sandbox: codingAgentTask.triggerAndWait(prompt)
    alt coding agent succeeds
        AgentTask->>GitHub: create PRs (via coding agent)
        GitHub-->>AgentTask: PR list
        loop per PR
            AgentTask->>GitHub: waitForPRChecks(pr)
            GitHub-->>AgentTask: checks status
            loop review iterations
                AgentTask->>GitHub: fetchPRReviews(pr)
                GitHub-->>AgentTask: reviews & comments
                AgentTask->>Sandbox: assessPRFeedback(reviews)
                alt actionable feedback
                    AgentTask->>AgentTask: updatePRTask.triggerAndWait(...)
                end
            end
            AgentTask->>GitHub: getVercelPreviewUrl(pr)
            GitHub-->>AgentTask: preview URL / null
            alt preview exists
                AgentTask->>GitHub: health check (preview/api/health)
            end
            AgentTask->>GitHub: mergePR(pr)
            GitHub-->>AgentTask: merge result
        end
        AgentTask->>Slack: postToSlackChannel(summary)
    else coding agent fails
        AgentTask->>Slack: postToSlackChannel(error)
    end
    AgentTask->>Sandbox: stop()
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly Related PRs

Poem

🐰 I hopped through commits and fetched each line,

Prompted the agent to craft something fine.
Reviews were inspected with a curious twitch,
Pushed fixes, checked previews, then merged with a twitch!
✨ Bravo—automation nibbles the glitch.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main feature addition: a scheduled autonomous task that runs on Sundays to plan, implement, review, and merge features.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/agent-day-task

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

const feedbackText = [reviewsText, commentsText].filter(Boolean).join("\n\n");

try {
const response = await fetch("https://api.anthropic.com/v1/messages", {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use claudeCode in a sandbox instead of anthropic api calls.

Based on this recent work, write a specific implementation prompt for an AI coding agent to implement the next most valuable feature.`;

try {
const response = await fetch("https://api.anthropic.com/v1/messages", {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use claudeCode in a sandbox instead of anthropic api calls. Use existing claude code sandbox libs.

};
}

logger.log(`Waiting for ${pending.length} checks on PR #${prNumber}`, {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace any usage of logger.log with the shared logStep function lib.

return false;
}

logger.log("Posted message to Slack", { channel: channelId });
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace all logger.log with shared logStep function.

…g with logStep

Addresses PR review feedback:
- Replace raw Anthropic API calls in assessPRFeedback and generateFeaturePrompt
  with runClaudeCodeAgent in a Vercel sandbox
- Replace logger.log with shared logStep function in waitForPRChecks and
  postToSlackChannel
- Create dedicated AI reasoning sandbox in agentDayTask with proper cleanup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (6)
src/github/mergePR.ts (1)

13-26: Consider wrapping fetch in try-catch for network failures.

Similar to postToSlackChannel, network-level errors (DNS, timeouts) will propagate uncaught. For consistency and resilience, consider catching and returning false.

♻️ Proposed fix to handle network errors
+  let response: Response;
+  try {
+    response = await fetch(
+      `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`,
+      {
+        method: "PUT",
+        headers: {
+          Authorization: `token ${token}`,
+          Accept: "application/vnd.github.v3+json",
+          "Content-Type": "application/json",
+        },
+        body: JSON.stringify({
+          merge_method: "squash",
+        }),
+      },
+    );
+  } catch (err) {
+    logger.error(`Network error merging PR #${prNumber} in ${repo}`, { error: String(err) });
+    return false;
+  }
-  const response = await fetch(
-    `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`,
-    {
-      method: "PUT",
-      headers: {
-        Authorization: `token ${token}`,
-        Accept: "application/vnd.github.v3+json",
-        "Content-Type": "application/json",
-      },
-      body: JSON.stringify({
-        merge_method: "squash",
-      }),
-    },
-  );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/mergePR.ts` around lines 13 - 26, The fetch call in mergePR (the
request to `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`) can
throw network-level errors; wrap the await fetch in a try-catch inside the
mergePR function (or the surrounding async function) and on catch return false
(matching postToSlackChannel behavior), logging or preserving the error as
appropriate; ensure the existing response handling remains inside the try block
and only returns true/false after successful fetch/response processing.
src/github/fetchRecentSubmoduleCommits.ts (1)

18-53: Consider parallel fetching for improved performance.

Sequential fetching across 11 submodules introduces latency. Since these are independent API calls (not Trigger.dev wait or triggerAndWait calls), they can safely be parallelized with Promise.allSettled while still handling individual failures gracefully.

⚡ Proposed optimization using parallel fetching
 export async function fetchRecentSubmoduleCommits(): Promise<SubmoduleCommit[]> {
   const token = process.env.GITHUB_TOKEN;
-  const results: SubmoduleCommit[] = [];
+  const entries = Object.entries(SUBMODULE_CONFIG);
 
-  for (const [submodule, { repo }] of Object.entries(SUBMODULE_CONFIG)) {
-    try {
-      const response = await fetch(
+  const fetchPromises = entries.map(async ([submodule, { repo }]) => {
+    try {
+      const response = await fetch(
         `https://api.github.com/repos/${repo}/commits?per_page=5`,
         {
           headers: {
             Authorization: `token ${token}`,
             Accept: "application/vnd.github.v3+json",
           },
         },
       );
 
       if (!response.ok) {
         logger.warn(`Failed to fetch commits for ${repo}`, { status: response.status });
-        continue;
+        return null;
       }
 
       const data = (await response.json()) as Array<{
         sha: string;
         commit: { message: string; author: { name: string; date: string } };
       }>;
 
-      results.push({
+      return {
         submodule,
         repo,
         commits: data.map((c) => ({
           sha: c.sha.slice(0, 7),
           message: c.commit.message.split("\n")[0],
           author: c.commit.author.name,
           date: c.commit.author.date,
         })),
-      });
+      } as SubmoduleCommit;
     } catch (error) {
       logger.warn(`Error fetching commits for ${repo}`, { error });
+      return null;
     }
-  }
+  });
 
-  return results;
+  const results = await Promise.all(fetchPromises);
+  return results.filter((r): r is SubmoduleCommit => r !== null);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/fetchRecentSubmoduleCommits.ts` around lines 18 - 53, The current
loop in fetchRecentSubmoduleCommits iterates sequentially over SUBMODULE_CONFIG
causing high latency; refactor it to perform the per-repo fetches in parallel by
mapping Object.entries(SUBMODULE_CONFIG) to an array of fetch promises and using
Promise.allSettled to wait for all; for each settled result, if fulfilled
validate response.ok (log via logger.warn with repo and status on non-ok), parse
JSON safely and push the transformed commit objects (sha slice, first-line
message, author, date) into results, and if rejected log the error with
logger.warn including the repo and error details so individual failures don't
abort the whole operation.
src/github/getVercelPreviewUrl.ts (1)

21-53: Consider wrapping fetch calls in try-catch for network error resilience.

The function returns null on non-OK responses but doesn't handle network exceptions from fetch(). If a network error occurs, the exception will propagate up to the caller.

🛡️ Proposed fix to handle network errors
 export async function getVercelPreviewUrl(
   repo: string,
   prNumber: number,
 ): Promise<string | null> {
   const token = process.env.GITHUB_TOKEN;
   const headers = {
     Authorization: `token ${token}`,
     Accept: "application/vnd.github.v3+json",
   };
 
+  try {
     const prRes = await fetch(`https://api.github.com/repos/${repo}/pulls/${prNumber}`, {
       headers,
     });
 
     if (!prRes.ok) return null;
 
     const pr = (await prRes.json()) as { head: { sha: string } };
 
     const checksRes = await fetch(
       `https://api.github.com/repos/${repo}/commits/${pr.head.sha}/check-runs`,
       { headers },
     );
 
     if (!checksRes.ok) return null;
     // ... rest of the function
+  } catch (error) {
+    logger.warn(`Error fetching Vercel preview URL for PR #${prNumber}`, { error });
+    return null;
+  }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/getVercelPreviewUrl.ts` around lines 21 - 53, The fetch calls in
getVercelPreviewUrl (calls that produce prRes, checksRes, statusRes, etc.) can
throw on network errors but currently only check response.ok; wrap the sequence
of fetches in a try-catch around the network interactions (or at least each
await fetch) and return null (or log and return null) on caught exceptions so
network failures don't propagate; ensure you catch errors thrown by
fetch/response.json and apply the same null-return behavior the function already
uses for non-OK responses.
src/tasks/agentDayTask.ts (2)

46-50: Inconsistent indentation inside try block.

The code starting at line 47 should be indented one additional level within the try block. This appears to be a formatting issue.

♻️ Fix indentation
     try {
-    // Step 1: Gather recent commits to understand what has been built recently
-    logStep("Fetching recent commits from all submodules");
-    const recentCommits = await fetchRecentSubmoduleCommits();
+      // Step 1: Gather recent commits to understand what has been built recently
+      logStep("Fetching recent commits from all submodules");
+      const recentCommits = await fetchRecentSubmoduleCommits();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/agentDayTask.ts` around lines 46 - 50, The code inside the try
block in agentDayTask.ts is mis-indented; adjust the indentation of the lines
starting with logStep("Fetching recent commits from all submodules"), the await
fetchRecentSubmoduleCommits() call, and the subsequent logStep("Recent commits
fetched", ...) so they are one additional level deeper (inside the try block) to
match block scope; ensure the statements around logStep and
fetchRecentSubmoduleCommits() are consistently indented and aligned with other
try/catch blocks or surrounding code.

144-153: Health check result is logged but not acted upon.

The Vercel preview health check captures the response status but doesn't fail the workflow or skip merge when the health endpoint returns an error status. If the preview is unhealthy, the PR will still be merged.

♻️ Proposed fix to skip merge on unhealthy preview
+          let previewHealthy = true;
           try {
             const healthRes = await fetch(`${previewUrl}/api/health`, {
               signal: AbortSignal.timeout(10_000),
             });
             logStep(`Preview health check for PR #${pr.number}`, true, {
               url: `${previewUrl}/api/health`,
               status: healthRes.status,
             });
+            if (!healthRes.ok) {
+              logger.warn(`Unhealthy preview for PR #${pr.number}`, { status: healthRes.status });
+              previewHealthy = false;
+            }
           } catch (error) {
             logger.warn(`Preview health check failed for PR #${pr.number}`, { error });
+            previewHealthy = false;
           }
+
+          if (!previewHealthy) {
+            logger.warn(`Skipping merge for PR #${pr.number} due to unhealthy preview`);
+            continue;
+          }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/agentDayTask.ts` around lines 144 - 153, The health-check fetch in
agentDayTask.ts currently only logs the response but doesn't stop processing on
non-2xx responses; after awaiting fetch (healthRes) check healthRes.ok (or
healthRes.status) and, if not healthy, throw or set a "previewUnhealthy"
error/flag so the caller can skip merge; update the try block that calls
fetch(`${previewUrl}/api/health`, ...) to treat non-ok responses as failures
(use existing logStep/logger.warn for context) and ensure the surrounding flow
(merge decision) observes that thrown error/flag to prevent merging an unhealthy
preview.
src/ai/assessPRFeedback.ts (1)

77-88: Consider validating parsed JSON with Zod.

The type assertion as FeedbackAssessment doesn't guarantee the parsed object has the required fields. Malformed AI output could lead to undefined values propagating downstream.

♻️ Proposed Zod validation
+import { z } from "zod";
+
+const FeedbackAssessmentSchema = z.object({
+  hasActionableFeedback: z.boolean(),
+  feedbackSummary: z.string(),
+  implementation: z.string(),
+});
+
 // In the try block:
     try {
-      const parsed = JSON.parse(text) as FeedbackAssessment;
+      const parsed = FeedbackAssessmentSchema.parse(JSON.parse(text));
       logStep("PR feedback assessment complete", false, {

As per coding guidelines: "Use Zod for schema validation" applies to src/**/*.{ts,tsx} files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/ai/assessPRFeedback.ts` around lines 77 - 88, Replace the unchecked JSON
assertion with Zod validation: define a Zod schema for FeedbackAssessment
(fields like hasActionableFeedback and feedbackSummary), parse the raw text with
JSON.parse into a temp value then run FeedbackAssessmentSchema.safeParse(temp)
inside the try; if safeParse succeeds return the validated data, otherwise log
the validation errors via logStep (include the sliced text and the
safeParse.error) and return noFeedback. Update the block using the symbols
parsed, FeedbackAssessment, FeedbackAssessmentSchema (or similar), logStep, and
noFeedback so downstream code gets a fully validated object.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/github/fetchPRReviews.ts`:
- Around line 71-77: The map that pushes PR review comments accesses
c.user.login without guarding against deleted/null GitHub accounts; update the
mapping in the comments.push(...data.map(...)) call to safely handle missing
c.user (e.g., use c.user?.login or a fallback like "deleted" or null) and ensure
other fields that may be absent are similarly guarded (author should be derived
from c.user?.login, leave body/path/createdAt as before).
- Around line 50-58: The mapping currently dereferences r.user.login which can
be null for deleted accounts; update the data processing so you first guard for
a present user (e.g., in the filter used before map) or provide a safe fallback
for the author field to avoid a crash. Specifically adjust the pipeline around
reviews.push and the data.filter/map (the anonymous arrow functions that
reference r.user.login and r.body) so the filter excludes entries with no r.user
or uses r.user?.login (or a fallback like "deleted" / "unknown") for author
while preserving body, state, and submitted_at extraction.
- Around line 29-33: Validate that process.env.GITHUB_TOKEN is set before
constructing headers in fetchPRReviews (token variable); if it's missing, throw
an explicit Error or exit with a clear message (e.g., "GITHUB_TOKEN is
required") so the Authorization header isn't built as "token undefined" and
authentication fails fast. Ensure the check occurs before creating the headers
object and reference the token constant used to build Authorization.

In `@src/github/mergePR.ts`:
- Around line 10-12: The mergePR function uses process.env.GITHUB_TOKEN without
checking it; add an early validation at the start of mergePR to detect a missing
or empty GITHUB_TOKEN and fail fast with a clear error (either throw an Error
with a descriptive message or log and return false) before constructing the
Authorization header; ensure the check references mergePR and prevents sending
"Authorization: token undefined" by exiting the function if the token is absent.

In `@src/github/waitForPRChecks.ts`:
- Around line 60-88: When checksData.check_runs is empty the polling loop never
exits; update the logic in waitForPRChecks (the loop that reads checks and
computes pending/failed using the checks variable) to detect checks.length === 0
and return early (e.g., log that no checks exist and return { allPassed: true,
failedChecks: [], pendingChecks: [] }) so repositories without CI don't poll
until timeout.

In `@src/slack/postToSlackChannel.ts`:
- Around line 19-26: postToSlackChannel should guard the fetch call against
network-level failures by wrapping the await fetch(...) in a try-catch inside
the postToSlackChannel function; on catch, log the caught error (including
error.message) and return false so the function consistently returns a boolean
for network errors, while preserving existing handling of API responses
(response.ok and parsed body). Locate the fetch invocation and the subsequent
response handling (variables named response and the JSON parsing) and move the
fetch+response parsing into the try block and return false from the catch after
logging contextual info (channelId/token context as appropriate).

In `@src/tasks/agentDayTask.ts`:
- Around line 88-94: The PR merge is proceeding regardless of CI results: use
the result returned by waitForPRChecks (checkResult) to gate merging—if
checkResult.allPassed is false, abort the merge flow, log an error via logStep
including checkResult.failedChecks, and return or throw to stop further actions;
only proceed to the existing merge logic when checkResult.allPassed is true
(reference waitForPRChecks, checkResult, logStep, PR_CHECK_TIMEOUT_MS).
- Around line 99-134: After a successful updatePRTask.triggerAndWait, call and
await a waitForPRChecks function (e.g., waitForPRChecks(pr.repo, pr.number,
currentSnapshotId)) before continuing the review loop; if waitForPRChecks
returns a non-passing state (timeout/failure), log a warning with details (use
logger.warn) and break the loop to avoid proceeding to merge on failing CI,
otherwise continue as before, ensuring the call is placed after updateResult.ok
handling and before the next iteration’s reassessment (replace or augment the
existing wait.for({ seconds: 30 }) with this check so CI status is validated).

---

Nitpick comments:
In `@src/ai/assessPRFeedback.ts`:
- Around line 77-88: Replace the unchecked JSON assertion with Zod validation:
define a Zod schema for FeedbackAssessment (fields like hasActionableFeedback
and feedbackSummary), parse the raw text with JSON.parse into a temp value then
run FeedbackAssessmentSchema.safeParse(temp) inside the try; if safeParse
succeeds return the validated data, otherwise log the validation errors via
logStep (include the sliced text and the safeParse.error) and return noFeedback.
Update the block using the symbols parsed, FeedbackAssessment,
FeedbackAssessmentSchema (or similar), logStep, and noFeedback so downstream
code gets a fully validated object.

In `@src/github/fetchRecentSubmoduleCommits.ts`:
- Around line 18-53: The current loop in fetchRecentSubmoduleCommits iterates
sequentially over SUBMODULE_CONFIG causing high latency; refactor it to perform
the per-repo fetches in parallel by mapping Object.entries(SUBMODULE_CONFIG) to
an array of fetch promises and using Promise.allSettled to wait for all; for
each settled result, if fulfilled validate response.ok (log via logger.warn with
repo and status on non-ok), parse JSON safely and push the transformed commit
objects (sha slice, first-line message, author, date) into results, and if
rejected log the error with logger.warn including the repo and error details so
individual failures don't abort the whole operation.

In `@src/github/getVercelPreviewUrl.ts`:
- Around line 21-53: The fetch calls in getVercelPreviewUrl (calls that produce
prRes, checksRes, statusRes, etc.) can throw on network errors but currently
only check response.ok; wrap the sequence of fetches in a try-catch around the
network interactions (or at least each await fetch) and return null (or log and
return null) on caught exceptions so network failures don't propagate; ensure
you catch errors thrown by fetch/response.json and apply the same null-return
behavior the function already uses for non-OK responses.

In `@src/github/mergePR.ts`:
- Around line 13-26: The fetch call in mergePR (the request to
`https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`) can throw
network-level errors; wrap the await fetch in a try-catch inside the mergePR
function (or the surrounding async function) and on catch return false (matching
postToSlackChannel behavior), logging or preserving the error as appropriate;
ensure the existing response handling remains inside the try block and only
returns true/false after successful fetch/response processing.

In `@src/tasks/agentDayTask.ts`:
- Around line 46-50: The code inside the try block in agentDayTask.ts is
mis-indented; adjust the indentation of the lines starting with
logStep("Fetching recent commits from all submodules"), the await
fetchRecentSubmoduleCommits() call, and the subsequent logStep("Recent commits
fetched", ...) so they are one additional level deeper (inside the try block) to
match block scope; ensure the statements around logStep and
fetchRecentSubmoduleCommits() are consistently indented and aligned with other
try/catch blocks or surrounding code.
- Around line 144-153: The health-check fetch in agentDayTask.ts currently only
logs the response but doesn't stop processing on non-2xx responses; after
awaiting fetch (healthRes) check healthRes.ok (or healthRes.status) and, if not
healthy, throw or set a "previewUnhealthy" error/flag so the caller can skip
merge; update the try block that calls fetch(`${previewUrl}/api/health`, ...) to
treat non-ok responses as failures (use existing logStep/logger.warn for
context) and ensure the surrounding flow (merge decision) observes that thrown
error/flag to prevent merging an unhealthy preview.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8c9c5fc-3347-493c-ac19-b3af66ebd2a2

📥 Commits

Reviewing files that changed from the base of the PR and between 5df28de and e47574d.

📒 Files selected for processing (19)
  • src/ai/__tests__/assessPRFeedback.test.ts
  • src/ai/__tests__/generateFeaturePrompt.test.ts
  • src/ai/assessPRFeedback.ts
  • src/ai/generateFeaturePrompt.ts
  • src/github/__tests__/fetchPRReviews.test.ts
  • src/github/__tests__/fetchRecentSubmoduleCommits.test.ts
  • src/github/__tests__/mergePR.test.ts
  • src/github/fetchPRReviews.ts
  • src/github/fetchRecentSubmoduleCommits.ts
  • src/github/getVercelPreviewUrl.ts
  • src/github/mergePR.ts
  • src/github/waitForPRChecks.ts
  • src/schemas/codingAgentSchema.ts
  • src/schemas/updatePRSchema.ts
  • src/slack/__tests__/postToSlackChannel.test.ts
  • src/slack/postToSlackChannel.ts
  • src/tasks/agentDayTask.ts
  • src/tasks/codingAgentTask.ts
  • src/tasks/updatePRTask.ts

Comment on lines +29 to +33
const token = process.env.GITHUB_TOKEN;
const headers = {
Authorization: `token ${token}`,
Accept: "application/vnd.github.v3+json",
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing validation for GITHUB_TOKEN.

If GITHUB_TOKEN is undefined, the Authorization header becomes "token undefined", which will silently fail authentication rather than failing fast with a clear error.

🛡️ Proposed fix to validate token
 export async function fetchPRReviews(repo: string, prNumber: number): Promise<PRFeedback> {
   const token = process.env.GITHUB_TOKEN;
+  if (!token) {
+    logger.warn("GITHUB_TOKEN not set, cannot fetch PR reviews");
+    return { reviews: [], comments: [] };
+  }
   const headers = {
     Authorization: `token ${token}`,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/fetchPRReviews.ts` around lines 29 - 33, Validate that
process.env.GITHUB_TOKEN is set before constructing headers in fetchPRReviews
(token variable); if it's missing, throw an explicit Error or exit with a clear
message (e.g., "GITHUB_TOKEN is required") so the Authorization header isn't
built as "token undefined" and authentication fails fast. Ensure the check
occurs before creating the headers object and reference the token constant used
to build Authorization.

Comment on lines +50 to +58
reviews.push(
...data
.filter((r) => r.body?.trim())
.map((r) => ({
author: r.user.login,
body: r.body,
state: r.state,
submittedAt: r.submitted_at,
})),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Potential null dereference on r.user.

GitHub API can return null for user when the account has been deleted or for certain bot actions. Accessing r.user.login would throw if user is null.

🛡️ Proposed fix to guard against null user
     reviews.push(
       ...data
-        .filter((r) => r.body?.trim())
+        .filter((r) => r.body?.trim() && r.user)
         .map((r) => ({
           author: r.user.login,
           body: r.body,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
reviews.push(
...data
.filter((r) => r.body?.trim())
.map((r) => ({
author: r.user.login,
body: r.body,
state: r.state,
submittedAt: r.submitted_at,
})),
reviews.push(
...data
.filter((r) => r.body?.trim() && r.user)
.map((r) => ({
author: r.user.login,
body: r.body,
state: r.state,
submittedAt: r.submitted_at,
})),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/fetchPRReviews.ts` around lines 50 - 58, The mapping currently
dereferences r.user.login which can be null for deleted accounts; update the
data processing so you first guard for a present user (e.g., in the filter used
before map) or provide a safe fallback for the author field to avoid a crash.
Specifically adjust the pipeline around reviews.push and the data.filter/map
(the anonymous arrow functions that reference r.user.login and r.body) so the
filter excludes entries with no r.user or uses r.user?.login (or a fallback like
"deleted" / "unknown") for author while preserving body, state, and submitted_at
extraction.

Comment on lines +71 to +77
comments.push(
...data.map((c) => ({
author: c.user.login,
body: c.body,
path: c.path,
createdAt: c.created_at,
})),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Same null user concern for comments.

Apply the same guard for c.user to prevent runtime errors on deleted accounts.

🛡️ Proposed fix
     comments.push(
-      ...data.map((c) => ({
+      ...data
+        .filter((c) => c.user)
+        .map((c) => ({
         author: c.user.login,
         body: c.body,
         path: c.path,
         createdAt: c.created_at,
       })),
     );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/fetchPRReviews.ts` around lines 71 - 77, The map that pushes PR
review comments accesses c.user.login without guarding against deleted/null
GitHub accounts; update the mapping in the comments.push(...data.map(...)) call
to safely handle missing c.user (e.g., use c.user?.login or a fallback like
"deleted" or null) and ensure other fields that may be absent are similarly
guarded (author should be derived from c.user?.login, leave body/path/createdAt
as before).

Comment on lines +10 to +12
export async function mergePR(repo: string, prNumber: number): Promise<boolean> {
const token = process.env.GITHUB_TOKEN;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add validation for missing GITHUB_TOKEN.

If GITHUB_TOKEN is undefined, the request sends Authorization: token undefined, which will fail with a 401 but produces a confusing error. Early validation provides a clearer failure mode.

🛡️ Proposed fix to validate token
 export async function mergePR(repo: string, prNumber: number): Promise<boolean> {
   const token = process.env.GITHUB_TOKEN;
+
+  if (!token) {
+    logger.error("Missing GITHUB_TOKEN — cannot merge PR");
+    return false;
+  }

   const response = await fetch(
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export async function mergePR(repo: string, prNumber: number): Promise<boolean> {
const token = process.env.GITHUB_TOKEN;
export async function mergePR(repo: string, prNumber: number): Promise<boolean> {
const token = process.env.GITHUB_TOKEN;
if (!token) {
logger.error("Missing GITHUB_TOKEN — cannot merge PR");
return false;
}
const response = await fetch(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/mergePR.ts` around lines 10 - 12, The mergePR function uses
process.env.GITHUB_TOKEN without checking it; add an early validation at the
start of mergePR to detect a missing or empty GITHUB_TOKEN and fail fast with a
clear error (either throw an Error with a descriptive message or log and return
false) before constructing the Authorization header; ensure the check references
mergePR and prevents sending "Authorization: token undefined" by exiting the
function if the token is absent.

Comment on lines +60 to +88
if (checks.length > 0) {
const pending = checks.filter((c) => c.status !== "completed");
const failed = checks.filter(
(c) =>
c.status === "completed" &&
c.conclusion !== "success" &&
c.conclusion !== "skipped" &&
c.conclusion !== "neutral",
);

if (pending.length === 0) {
logStep(`All checks complete for PR #${prNumber}`, false, {
total: checks.length,
failed: failed.length,
});
return {
allPassed: failed.length === 0,
failedChecks: failed.map((c) => c.name),
pendingChecks: [],
};
}

logStep(`Waiting for ${pending.length} checks on PR #${prNumber}`, false, {
pending: pending.map((c) => c.name),
});
}

await wait.for({ seconds: 30 });
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Handle the case when no check runs exist for the commit.

If a repository has no CI checks configured, checksData.check_runs will be empty and the loop will poll until timeout. Consider returning early when no checks exist.

🐛 Proposed fix to handle empty check runs
     const checks = checksData.check_runs;
 
+    // If no checks are configured, consider it passed
+    if (checks.length === 0) {
+      logStep(`No check runs found for PR #${prNumber}`, false);
+      return { allPassed: true, failedChecks: [], pendingChecks: [] };
+    }
+
-    if (checks.length > 0) {
       const pending = checks.filter((c) => c.status !== "completed");
       const failed = checks.filter(
         (c) =>
           c.status === "completed" &&
           c.conclusion !== "success" &&
           c.conclusion !== "skipped" &&
           c.conclusion !== "neutral",
       );
 
       if (pending.length === 0) {
         logStep(`All checks complete for PR #${prNumber}`, false, {
           total: checks.length,
           failed: failed.length,
         });
         return {
           allPassed: failed.length === 0,
           failedChecks: failed.map((c) => c.name),
           pendingChecks: [],
         };
       }
 
       logStep(`Waiting for ${pending.length} checks on PR #${prNumber}`, false, {
         pending: pending.map((c) => c.name),
       });
-    }
 
     await wait.for({ seconds: 30 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (checks.length > 0) {
const pending = checks.filter((c) => c.status !== "completed");
const failed = checks.filter(
(c) =>
c.status === "completed" &&
c.conclusion !== "success" &&
c.conclusion !== "skipped" &&
c.conclusion !== "neutral",
);
if (pending.length === 0) {
logStep(`All checks complete for PR #${prNumber}`, false, {
total: checks.length,
failed: failed.length,
});
return {
allPassed: failed.length === 0,
failedChecks: failed.map((c) => c.name),
pendingChecks: [],
};
}
logStep(`Waiting for ${pending.length} checks on PR #${prNumber}`, false, {
pending: pending.map((c) => c.name),
});
}
await wait.for({ seconds: 30 });
}
// If no checks are configured, consider it passed
if (checks.length === 0) {
logStep(`No check runs found for PR #${prNumber}`, false);
return { allPassed: true, failedChecks: [], pendingChecks: [] };
}
const pending = checks.filter((c) => c.status !== "completed");
const failed = checks.filter(
(c) =>
c.status === "completed" &&
c.conclusion !== "success" &&
c.conclusion !== "skipped" &&
c.conclusion !== "neutral",
);
if (pending.length === 0) {
logStep(`All checks complete for PR #${prNumber}`, false, {
total: checks.length,
failed: failed.length,
});
return {
allPassed: failed.length === 0,
failedChecks: failed.map((c) => c.name),
pendingChecks: [],
};
}
logStep(`Waiting for ${pending.length} checks on PR #${prNumber}`, false, {
pending: pending.map((c) => c.name),
});
await wait.for({ seconds: 30 });
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/github/waitForPRChecks.ts` around lines 60 - 88, When
checksData.check_runs is empty the polling loop never exits; update the logic in
waitForPRChecks (the loop that reads checks and computes pending/failed using
the checks variable) to detect checks.length === 0 and return early (e.g., log
that no checks exist and return { allPassed: true, failedChecks: [],
pendingChecks: [] }) so repositories without CI don't poll until timeout.

Comment on lines +19 to +26
const response = await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ channel: channelId, text }),
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider wrapping fetch in try-catch for network failures.

The function handles Slack API errors (ok: false) but doesn't catch network-level failures (DNS resolution, connection timeouts). If fetch throws, the error propagates uncaught, which may be unexpected given the function signature implies it returns boolean for all outcomes.

🛡️ Proposed fix to handle network errors
 export async function postToSlackChannel(channelId: string, text: string): Promise<boolean> {
   const token = process.env.SLACK_BOT_TOKEN;

   if (!token) {
     logger.error("Missing SLACK_BOT_TOKEN — cannot post to Slack");
     return false;
   }

+  let response: Response;
+  try {
+    response = await fetch("https://slack.com/api/chat.postMessage", {
+      method: "POST",
+      headers: {
+        "Content-Type": "application/json",
+        Authorization: `Bearer ${token}`,
+      },
+      body: JSON.stringify({ channel: channelId, text }),
+    });
+  } catch (err) {
+    logger.error("Network error posting to Slack", { channel: channelId, error: String(err) });
+    return false;
+  }
-  const response = await fetch("https://slack.com/api/chat.postMessage", {
-    method: "POST",
-    headers: {
-      "Content-Type": "application/json",
-      Authorization: `Bearer ${token}`,
-    },
-    body: JSON.stringify({ channel: channelId, text }),
-  });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const response = await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ channel: channelId, text }),
});
let response: Response;
try {
response = await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ channel: channelId, text }),
});
} catch (err) {
logger.error("Network error posting to Slack", { channel: channelId, error: String(err) });
return false;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/slack/postToSlackChannel.ts` around lines 19 - 26, postToSlackChannel
should guard the fetch call against network-level failures by wrapping the await
fetch(...) in a try-catch inside the postToSlackChannel function; on catch, log
the caught error (including error.message) and return false so the function
consistently returns a boolean for network errors, while preserving existing
handling of API responses (response.ok and parsed body). Locate the fetch
invocation and the subsequent response handling (variables named response and
the JSON parsing) and move the fetch+response parsing into the try block and
return false from the catch after logging contextual info (channelId/token
context as appropriate).

Comment on lines +88 to +94
// Step 5a: Wait for all CI checks to complete
logStep(`Waiting for checks on PR #${pr.number}`);
const checkResult = await waitForPRChecks(pr.repo, pr.number, PR_CHECK_TIMEOUT_MS);
logStep(`Checks complete for PR #${pr.number}`, true, {
allPassed: checkResult.allPassed,
failedChecks: checkResult.failedChecks,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

PRs are merged regardless of CI check failures.

The code logs checkResult.failedChecks but proceeds to merge even when allPassed is false. This could merge broken code into main. Consider gating the merge on CI success.

🐛 Proposed fix to gate merge on CI success
+      // Skip merge if CI checks failed
+      if (!checkResult.allPassed) {
+        logger.warn(`Skipping merge for PR #${pr.number} due to failed checks`, {
+          failedChecks: checkResult.failedChecks,
+          pendingChecks: checkResult.pendingChecks,
+        });
+        continue;
+      }
+
       // Step 6: Merge the PR
       logStep(`Merging PR #${pr.number} in ${pr.repo}`);
       const merged = await mergePR(pr.repo, pr.number);

Also applies to: 159-168

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/agentDayTask.ts` around lines 88 - 94, The PR merge is proceeding
regardless of CI results: use the result returned by waitForPRChecks
(checkResult) to gate merging—if checkResult.allPassed is false, abort the merge
flow, log an error via logStep including checkResult.failedChecks, and return or
throw to stop further actions; only proceed to the existing merge logic when
checkResult.allPassed is true (reference waitForPRChecks, checkResult, logStep,
PR_CHECK_TIMEOUT_MS).

Comment on lines +99 to +134
for (let iteration = 0; iteration < MAX_REVIEW_ITERATIONS; iteration++) {
logStep(`Review iteration ${iteration + 1} for PR #${pr.number}`);

const feedback = await fetchPRReviews(pr.repo, pr.number);
const assessment = await assessPRFeedback(aiSandbox, pr.repo, featurePrompt, feedback);

logStep(`Feedback assessed for PR #${pr.number}`, true, {
hasActionableFeedback: assessment.hasActionableFeedback,
summary: assessment.feedbackSummary,
});

if (!assessment.hasActionableFeedback) {
break; // Nothing to address — move on
}

// Step 5c: Apply the feedback via the update-pr task
logStep(`Applying feedback for PR #${pr.number}: ${assessment.feedbackSummary}`);
const updateResult = await updatePRTask.triggerAndWait({
feedback: assessment.implementation,
snapshotId: reviewSnapshotId,
branch,
repo: pr.repo,
});

if (!updateResult.ok) {
logger.warn(`Failed to apply feedback for PR #${pr.number}`, {
error: updateResult.error,
});
break;
}

reviewSnapshotId = updateResult.output.snapshotId;
currentSnapshotId = reviewSnapshotId;

// Wait for the new commit to be picked up by CI before re-checking
await wait.for({ seconds: 30 });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Review loop doesn't re-check CI after applying feedback.

After applying feedback via updatePRTask (line 116), the loop waits 30 seconds but only re-assesses PR feedback without verifying that CI passes on the new commits. A PR with failing checks after the final iteration would still proceed to merge.

Consider adding a waitForPRChecks call after applying feedback to ensure the fix didn't break CI before the next iteration or before merge.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/agentDayTask.ts` around lines 99 - 134, After a successful
updatePRTask.triggerAndWait, call and await a waitForPRChecks function (e.g.,
waitForPRChecks(pr.repo, pr.number, currentSnapshotId)) before continuing the
review loop; if waitForPRChecks returns a non-passing state (timeout/failure),
log a warning with details (use logger.warn) and break the loop to avoid
proceeding to merge on failing CI, otherwise continue as before, ensuring the
call is placed after updateResult.ok handling and before the next iteration’s
reassessment (replace or augment the existing wait.for({ seconds: 30 }) with
this check so CI status is validated).

}
}

function getFallbackPrompt(): string {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srp - move any functions with names different from the file name to a different function.

sweetmantech and others added 2 commits March 24, 2026 09:36
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of automatically merging PRs, agent-day now sends a Telegram
message with PR links so a human can review and merge manually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant